package com.wanho.qz103.hrsaas.process.dao.impl;

import com.wanho.qz103.hrsaas.commons.annontations.Repository;
import com.wanho.qz103.hrsaas.commons.dao.impl.BaseDAOImpl;
import com.wanho.qz103.hrsaas.commons.exception.DAOException;
import com.wanho.qz103.hrsaas.commons.exception.DataAccessException;
import com.wanho.qz103.hrsaas.process.dao.QuitDAO;
import com.wanho.qz103.hrsaas.process.pojos.Quit;

@Repository
public class QuitDAOImpl extends BaseDAOImpl<Quit> implements QuitDAO {
    @Override
    public Quit selectByProInstanceId(String proInstanceId) throws DAOException {
        try {
            String sql = "select id,userId,proInstanceId,reason,exceptTime,processKey,processName from process_quit where proInstanceId=?" ;
            Object[] paramAy = {proInstanceId} ;
            return jdbcTemplate.queryObject(sql,Quit.class,paramAy);
        } catch (DataAccessException e) {
            e.printStackTrace();
            throw new DAOException("根据用户id和流程key查询失败！") ;
        }
    }
    @Override
    protected String deleteSQL() {
        return null;
    }

    @Override
    protected String insertSQL() {
        return "insert into process_quit(id,userid,proInstanceId,reason,exceptTime,processKey,processName) values (#{id},#{userId},#{proInstanceId},#{reason},#{exceptTime},#{processKey},#{processName})";
    }

    @Override
    protected String updateSQL() {
        return null;
    }

    @Override
    protected String selectByIdSQL() {
        return null;
    }

}
